<?php
/*
  $Id: new_products.php,v 1.34 2003/06/09 22:49:58 hpdl Exp $

  osCommerce, Open Source E-Commerce Solutions
  http://www.oscommerce.com

  Copyright (c) 2003 osCommerce

  Released under the GNU General Public License
*/
?>
<!-- new_products //-->
<?php
  $info_box_contents = array();
  $info_box_contents[] = array('text' => sprintf(TABLE_HEADING_NEW_PRODUCTS, strftime('%B')));

 // new contentBoxHeading($info_box_contents);
  $MAX_DISPLAY_TOP_VIEW_PRODUCTS = 9;
  $product_top_view_query = tep_db_query("select p.products_id, pd.products_name, p.products_price, p.products_tax_class_id, p.products_image from " . TABLE_PRODUCTS . " p right join ". TABLE_PRODUCTS_VIEW_COUNT . " pv on p.products_id = pv.products_id, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "' order by pv.products_count desc limit " . $MAX_DISPLAY_TOP_VIEW_PRODUCTS);	
  
  $row = 0;
  $col = 0;
  $info_box_contents = array();
  while ($product_top_view = tep_db_fetch_array($product_top_view_query)) {
 
  
    $product_top_view['products_name'] = tep_get_products_name($product_top_view['products_id']);
	
// ----------	
	$product_query = tep_db_query("select products_description, products_id from " . TABLE_PRODUCTS_DESCRIPTION . " where products_id = '" . (int)$product_top_view['products_id'] . "' and language_id = '" . (int)$languages_id . "'");
	$product = tep_db_fetch_array($product_query);
	// begin : Vunh added to fix font error 
		$p_desc = substr($product['products_description'], 0, MAX_DESCR_1);
		// end : Vunh added to fix font error
	$p_id = $product['products_id'];
	
	$p_pic = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $product_top_view['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $product_top_view['products_image'], $product_top_view['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a>';
	
	$p_name = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $product_top_view['products_id']) . '">' . substr($product_top_view['products_name'],0,MAX_DESCR_NAME) . '</a>';
	
	$p_price = ''.$currencies->display_price($product_top_view['products_price'], tep_get_tax_rate($product_top_view['products_tax_class_id'])).'';
// ----------	
	
    $info_box_contents[$row][$col] = array('align' => 'center',
                                           'params' => ' valign="top"',
                                           'text' => ''.tep_draw_prod_top().'
												<table cellspacing="0" cellpadding="0" border="0" >
													<tr>
														<td width="157" height="52" style=" vertical-align:middle;">
											 			 '.$p_name.'</td>
													</tr>
													<tr>
														<td width="157" height="156" class="pic" align="center">'.$p_pic.'</td>
													</tr>
													<tr>
														<td width="157" height="45">'.$p_desc.'...</td>
													</tr>													
												</table>	
												
			'.tep_draw_prod_bottom());

    $col ++;
    /*if ($col > 2) {
      $col = 0;
      $row ++;
    }*/
  }
  
echo '<marquee direction="left" scrolldelay="100" behavior="scroll" onmouseout="this.start()" onmouseover="this.stop()">';
  new contentBox_OKKO_top_view($info_box_contents);
echo '  </marquee></div>';

?>
<!-- new_products_eof //-->
